package com.wzx.controller;

import com.wzx.common.Result;
import com.wzx.pojo.Admin;
import com.wzx.pojo.User;
import com.wzx.service.AdminService;
import com.wzx.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/admin")
public class AdminController {

    @Autowired
    private AdminService adminService;

    @PostMapping("/login")
    public Result userLogin(@RequestBody Admin admin){
        return adminService.login(admin);
    }

    @Transactional
    @GetMapping("/loginOut")
    public Result adminLoginOut(){
        return adminService.loginOut();
    }

}
